package cn.tedu.springbootrabbitmq.consumer;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@RabbitListener(queues = "test_queue")//监听队列
public class RabbitConsumer {

    //处理这个消息的方法，需要添加@RabbitHandler注解，还可以通过参数就可以转成指定的类型
    @RabbitHandler//整个类中，只能有一个方法添加了@RabbitHandler注解
    public void process(LocalDateTime localDateTime){
        System.out.println("接收到的消息是："+localDateTime);
    }
}
